import { AXIOS_DEFAULT_CONFIG } from '@/settings'

import axios from 'axios'
import {
  requestBeforeFun,
  requestFaultFun,
  responseSuccessFun,
  responseFailFun
} from './interceptors'

const instance = axios.create(AXIOS_DEFAULT_CONFIG)

// 注入请求拦截
instance.interceptors.request.use(requestBeforeFun, requestFaultFun)
// 注入响应拦截
instance.interceptors.response.use(responseSuccessFun, responseFailFun)

export default instance
